"""

竞赛列表页

"""

from selenium.webdriver.common.by import By

from pom.base import BaseDriver

class CompetitionListPage(BaseDriver):
    def __init__(self, driver):
        super(CompetitionListPage, self).__init__(driver)

    # 竞赛管理
    _com_manage = By.XPATH, '//span[text()="竞赛管理"]'

    # 竞赛列表
    _com_list = By.XPATH, '//li[text()="竞赛列表"]'

    # 竞赛搜索框
    _com_search = By.XPATH, '//input'

    # 搜索按钮
    _serach_button = By.XPATH, '//button[@class="el-button el-button--default"]'

    # 竞赛列表中数据
    def ComListData(self, col, line):
        tmp = By.XPATH,*'//tbody/tr[line]/td[col]'.format(line, col)
        ele = self.find_ele(*tmp)
        return ele.text

    @property
    def com_manage(self):
        ele = self.find_ele(*self._com_manage)
        self.logger.info("竞赛管理")
        return ele

    @property
    def com_list(self):
        ele = self.find_ele(*self._com_list)
        self.logger.info("竞赛列表")
        return ele

